﻿using System;
using System.ComponentModel;
using System.Xml.Serialization;
using Microsoft.WowAddonStudio.FrameXml.Serialization.LayoutFrames;

namespace Microsoft.WowAddonStudio.FrameXml.Serialization.LayoutFrames
{
    [Serializable]
    [DesignerCategory("code")]
    [XmlType(Namespace = "http://www.blizzard.com/wow/ui/")]
    [XmlRoot(Namespace = "http://www.blizzard.com/wow/ui/", IsNullable = false)]
    public class MessageFrame : Frame
    {
        /// <summary>
        /// Gets or sets the font for the message frame.
        /// </summary>
        [XmlAttribute("font")]
        [Category("Appearance")]
        [Description("The font used to display the text.")]
        public string Font
        {
            get { return Properties.GetValue<string>("Font"); }
            set { Properties.SetValue("Font", value); }
        }

        /// <summary>
        /// Gets or sets a value indicating whether the message should fade. The default is true.
        /// </summary>
        [XmlAttribute("fade")]
        [DefaultValue(true)]
        [Category("Appearance")]
        [Description("Defines a value indicating whether the message should fade. The default is true.")]
        public bool Fade
        {
            get { return Properties.GetValue<bool>("Fade"); }
            set { Properties.SetValue("Fade", value); }
        }

        /// <summary>
        /// Gets or sets the duration of the fading of the messages in seconds. The default is 3 seconds.
        /// </summary>
        [XmlAttribute("fadeDuration")]
        [DefaultValue(3f)]
        [Category("Appearance")]
        [Description("Defines the duration of the fading of the messages in seconds. The default is 3 seconds.")]
        public float FadeDuration
        {
            get { return Properties.GetValue<float>("FadeDuration"); }
            set { Properties.SetValue("FadeDuration", value); }
        }

        /// <summary>
        /// Gets or sets the duration of how long the message are displayed in seconds. The default is 10 seconds.
        /// </summary>
        [XmlAttribute("displayDuration")]
        [DefaultValue(10f)]
        [Category("Appearance")]
        [Description("Defines the duration of how long the message are displayed in seconds. The default is 10 seconds.")]
        public float DisplayDuration
        {
            get { return Properties.GetValue<float>("DisplayDuration"); }
            set { Properties.SetValue("DisplayDuration", value); }
        }

        /// <summary>
        /// Gets or sets where the messages should be inserted. The default is bottom.
        /// </summary>
        [XmlAttribute("insertMode")]
        [DefaultValue(InsertMode.Bottom)]
        [Category("Behavior")]
        [Description("Tells a MessageFrame where to put new content. Accepts \"TOP\" or \"BOTTOM\". Default \"TOP\".")]
        public InsertMode InsertMode
        {
            get { return Properties.GetValue<InsertMode>("InsertMode"); }
            set { Properties.SetValue("InsertMode", value); }
        }
    }
}